package tsj.ai.alibaba.data.analysis.service.schema;

import org.springframework.ai.document.Document;
import tsj.ai.alibaba.data.analysis.common.connector.config.DbConfig;
import tsj.ai.alibaba.data.analysis.dto.schema.SchemaDTO;

import java.util.List;

/**
 * @author taoshujian
 * @version 1.0
 * @since 2025-11-14 11:41:09
 */
public interface SchemaService {
    List<Document> getTableDocumentsForAgent(String agentId, String query);

    List<List<Document>> getColumnDocumentsByKeywordsForAgent(String agentId, List<String> keywords);

    void extractDatabaseName(SchemaDTO schemaDTO, DbConfig dbConfig);

    void buildSchemaFromDocuments(String agentId, List<List<Document>> columnDocumentList,
                                  List<Document> tableDocuments, SchemaDTO schemaDTO);

    SchemaDTO mixRagForAgent(String agentId, String query, List<String> keywords, DbConfig dbConfig);

    default List<Document> getTableDocuments(String query) {
        return getTableDocumentsForAgent(null, query);
    }

    default List<List<Document>> getColumnDocumentsByKeywords(List<String> keywords) {
        return getColumnDocumentsByKeywordsForAgent(null, keywords);
    }
}
